;(function($){
	
$(".cgw-loca-select").click(function() {
	if ($('body').hasClass('loca-selectd') == false) {
		$('body').addClass("loca-selectd");
		$(".cgw-select-list").show();
	} else {
		$('body').removeClass("loca-selectd");
		$(".cgw-select-list").hide();
	}
});

// 导航展开合并效果
$(document).on("click", ".cgw-sidebar-menu-take", function() {
	var menuid = $(this).parent(".cgw-sidebar-box").attr("id");
	var p = $(this).parent(".cgw-sidebar-box");
	if (p.hasClass("cgw-sidebar-open")) {
		$("#" + menuid + " .subli").show();
		p.removeClass("cgw-sidebar-open");
	} else {
		$("#" + menuid + " .subli").hide();
		p.addClass("cgw-sidebar-open");
	}
});

//用总部账号登陆大区，侧边栏展示缩进修改
$(document).on("click", ".cgw-menu-more", function() {
	var menuid = $(this).parent(".cgw-sidebar-box").attr("id");
	var p = $(this).parent(".cgw-sidebar-box");
	if (!$(this).hasClass("cgw-menu-more-open")) {
		$("#" + menuid + " .subli").show();
		$(this).addClass("cgw-menu-more-open");
		$(this).children("i").addClass("icon-chevron-down");
	} else {
		$("#" + menuid + " .subli:gt(2)").hide();
		$(this).show();
		$(this).removeClass("cgw-menu-more-open");
		$(this).children("i").removeClass("icon-chevron-down");
	}
});
function domReady(){
	var _ps=$(".page-sidebar"),_cf=$(".page-content");
	if(_ps.height()>_cf.height()){
		var menuid = $(".cgw-menu-more").parent(".cgw-sidebar-box").attr("id");
		$("#" + menuid + " .subli:gt(2)").hide();
		//console.log($("#" + menuid + " .subli:gt(2)"));
		$(".cgw-menu-more").show();
		$(".cgw-menu-more").removeClass("cgw-menu-more-open");
		$(".cgw-menu-more").children("i").removeClass("icon-chevron-down");
	}
}
$(domReady);
//获得当前文件的文件名
function getDataListName() {
	var strUrl = window.location.href;
	var arrUrl = strUrl.split("/");
	var strPage = arrUrl[arrUrl.length - 1];
	return strPage;
}
var jsonUrlForCS = "/Managerial_Network/";
/*	alert("可见区域宽度："+document.body.clientWidth);
	alert("屏幕分辨率："+window.screen.width);*/
// 加载 导航
var _loadMenuRequests = ["./media/local-json-" + rn.pageLocation + "/siderbar.json", jsonUrl + 'user/loadMenu'];
$.ajax({
	url: _loadMenuRequests[0],
	dataType: _loadMenuRequests[0].indexOf(".json") > -1 ? "json" : "jsonp",
	data: '',
	jsonp: 'callback',
	async:false,
	beforeSend: function() {
		$("#navLoad").html('加载中...');
	},
	complete: function() {},
	success: function(result) {
		$("#navLoad").hide();
		var _checkUrlRex = /(http[s]?|ftp):\/\/[^\/\.]+?\..+\w$/i, 	//验证是不是一个完整地址的正则  brose
			resObj = result.result.resrc; 							//json数据resrc节点  brose
		$.each(resObj, function(roIndex, roItem) {
			var subList = roItem.subList;
			var innerDataList = '';			
			$.each(subList, function(slIndex, slItem) {
				var _slLinkHref = slItem.linkHref;
				_baseHtml='<li class="subli"><a  href="javascript:void(0);"><i class="' + slItem.linkIcon + ' hidden-tablet"></i> <span class="title">' + slItem.linkName + '</span></a></li>';
				innerDataList += _baseHtml;
			});
			/*//最后一个节点菜单添加单击箭头，提供展开收缩功能  brose
			if (roIndex===resObj.length-1) { 
				innerDataList += '<li class="subli cgw-menu-more"><i class="icon-chevron-up"></i></li>';
			} */
			var innerData = '<ul class="page-sidebar-menu cgw-sidebar-box" id="cgw-sidebar-nav' + roIndex + '"><li class="cgw-sidebar-menu-title cgw-sidebar-menu-take"><div class="nav_title_line" href="javascript:;"><span>' + roItem.navTitle + '</span><i class="halflings-icon white cog"></i></div></li>' + innerDataList + '</ul>';
			$(".page-sidebar").append(innerData);
		});

	},
	timeout: 10000,
	error: function(er) {
		//console.log("%cloadMenu错误状态" + er.statusText, "color:red");
		$("#navLoad").html("数据请求超时");
	},
});
//监听左侧导航树操作按钮事件,resize charts
/*var _navTogBtn = document.getElementsByClassName("sidebar-toggler")[0];
addHandler(_navTogBtn, "click", function() {
	setTimeout("_chartsResizeFn()", 200);
});*/
//窗口宽度变化, resize charts
//addHandler(window,"resize",_chartsResizeFn);

function _chartsResizeFn() {
	if (pChart && pChart !== "undefined") pChart.resize();
	if (lChart && lChart !== "undefined") lChart.resize();
	if (mChart && mChart !== "undefined") mChart.resize();
	if (apsChart && apsChart !== "undefined") apsChart.resize();
	if (bChart && bChart !== "undefined") bChart.resize();
	if (prChart && prChart !== "undefined") prChart.resize();
	if (paChart && paChart !== "undefined") paChart.resize();
	if (sChart && sChart !== "undefined") sChart.resize();

	if (cpuChart && cpuChart !== "undefined") cpuChart.resize();
	if (memoryChart && memoryChart !== "undefined") memoryChart.resize();
	if (diskChart && diskChart !== "undefined") diskChart.resize();

	if (wifiApCharts && wifiApCharts !== "undefined") wifiApCharts.resize();
	if (wifiApMapChart && wifiApMapChart !== "undefined") wifiApMapChart.resize();
	if (wifiApLinkChart && wifiApLinkChart !== "undefined") wifiApLinkChart.resize();
	if (wifiApCountChart && wifiApCountChart !== "undefined") wifiApCountChart.resize();

	if (moveOnlineTime && moveOnlineTime !== "undefined") moveOnlineTime.resize();
	if (moveDeviceType && moveDeviceType !== "undefined") moveDeviceType.resize();
	if (moveDeviceMap && moveDeviceMap !== "undefined") moveDeviceMap.resize();
	if (moveOnlineCount && moveOnlineCount !== "undefined") moveOnlineCount.resize();
	if (moveProtcol && moveProtcol !== "undefined") moveProtcol.resize();
	if (moveNewUpUser && moveNewUpUser !== "undefined") moveNewUpUser.resize();

	if (moveMTCallTime && moveMTCallTime !== "undefined") moveMTCallTime.resize();
	if (moveMTGprs && moveMTGprs !== "undefined") moveMTGprs.resize();
	if (moveMTMsg && moveMTMsg !== "undefined") moveMTMsg.resize();
	if (moveMCallTime && moveMCallTime !== "undefined") moveMCallTime.resize();
	if (moveMGprs && moveMGprs !== "undefined") moveMGprs.resize();
	if (moveMMsg && moveMMsg !== "undefined") moveMMsg.resize();
	if (typeof(init_word_cloud) === "function")
		init_word_cloud();
}
})($)

